import request from "@/utils/request";

// 查询报名信息列表
export function listRegisterInfo(query) {
  return request({
    url: "/business/registerInfo/list",
    method: "get",
    params: query,
  });
}
export function getLastRegisterInfo() {
  return request({
    url: "/business/registerInfo/getLast",
    method: "get",
  });
}

// 获取省
export function getArea() {
  return request({
    url: "/business/area/getTopArea",
    method: "get",
  });
}

// 获取市区县 business/area/getChildArea/{id}
export function getChildArea(id) {
  return request({
    url: "/business/area/getChildArea/" + id,
    method: "get",
  });
}

// 学员端查询我的申请报名信息列表
export function indexListRegisterInfo(query) {
  return request({
    url: "/business/registerInfo/index/list",
    method: "get",
    params: query,
  });
}

// 查询报名信息所有列表
export function listAllRegisterInfo(query) {
  return request({
    url: "/business/registerInfo/listJxPerson",
    method: "get",
    params: query,
  });
}

// 查询报名信息详细
export function getRegisterInfo(id) {
  return request({
    url: "/business/registerInfo/getInfo/" + id,
    method: "get",
  });
}

//查询审批记录
export function getAuditLog(id) {
  return request({
    url: "/business/auditLog/getAllAuditLogList/" + id,
    method: "get",
  });
}

//查询退回拒绝的理由
export function getAuditList(id) {
  return request({
    url: "/business/auditLog/getAuditList/" + id,
    method: "get",
  });
}
// 新增报名信息
export function addRegisterInfo(data) {
  return request({
    url: "/business/registerInfo/add",
    method: "post",
    data: data,
  });
}

// 新增代理报名信息
export function agentRegisterInfo(data) {
  return request({
    url: "/business/registerInfo/agent",
    method: "post",
    data: data,
  });
}

// 修改报名信息
export function updateRegisterInfo(data) {
  return request({
    url: "/business/registerInfo/edit",
    method: "post",
    data: data,
  });
}

// 删除报名信息
export function delRegisterInfo(id) {
  return request({
    url: "/business/registerInfo/remove/" + id,
    method: "get",
  });
}

// 获取签字文档
export function getSignBook(data) {
  return request({
    url: "/business/registerSign/getSignBook",
    method: "post",
    data: data,
  });
}
// 根据expireUuid实时查询二维码是否有效（有效时间2分钟）
export function getUserWriteSign(expireUuid) {
  return request({
    url: `business/registerSign/getUserWriteSign/${expireUuid}`,
    method: "get",
  });
}

//单个签字
export function addSignBook(data) {
  return request({
    url: "/business/registerSign/addSignBook",
    method: "post",
    data: data,
  });
}

//获取批量签字二维码
export function getKSBatchQRCode(data) {
  return request({
    url: "/business/registerSign/getKSBatchQRCode",
    method: "post",
    data: data,
  });
}

//获取已签的文档
export function getSignedBook(id) {
  return request({
    url: `/business/registerSign/getSignedInfo/${id}`,
    method: "get",
  });
}

//预设签名
export function addOrUpdate(data) {
  return request({
    url: "/business/userSign/addOrUpdate",
    method: "post",
    data: data,
  });
}

//批量签字
export function addKXBatchSign(data) {
  return request({
    url: "/business/registerSign/addKXBatchSign",
    method: "post",
    data: data,
  });
}

//获取用户签名
export function getUserSign(id) {
  return request({
    url: `/business/userSign/getInfo/${id}`,
    method: "get",
  });
}

//判断用户是否需要签名
export function getUserSignStatus(data) {
  return request({
    url: `/business/registerSign/isNeedSign`,
    method: "post",
    data: data,
  });
}
